<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <title></title>
  <link rel="stylesheet" href="../../template/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="../../template/website/css/app.css"/>
</head>
<body>
  <div class="am-u-sm-12 am-padding-top-xs">
  <img id="image" src=""/>
  </div>
  <div class="am-u-sm-12 am-padding-top-xs  am-padding-bottom-xs">
    <button type="button" class="am-btn am-btn-primary am-btn-block" id='submit_btn'>立即办理</button>
  </div>

  <script type="text/javascript" src="../../template/assets/js/jquery.min.js"></script>
  <script type="text/javascript" src="../../template/assets/js/amazeui.min.js"></script>
  <script type="text/javascript" src="../../template/assets/js/handlebars.min.js"></script>
  <script type="text/javascript" src="../../template/assets/js/amazeui.widgets.helper.min.js"></script>
  <script type="text/javascript" src="../../template/website/js/app.js"></script>
  <script type="text/javascript">
    $(function(){
      document.title=getTitle(getParamValue("efType")); 
      initImage();
      $('#submit_btn').on('click', function(){
        var efType = getParamValue("efType");
        window.location.href = getUrl(efType);        
      });
    });

    function getUrl(efType){
      console.log("efType="+efType);
      var url = "";
      var params = getParams();
      if(efType == "ll"){
        url = "http://120.24.49.23:6080/dpr/go/forward?uri=dzg/activity_template&id=llfjb&type=activities&child_type=llfjb&index_url=dzg/edu_activities&"+getParams();
      } else if(efType == "kd"){
        url = "../broadband_list.html?"+params+"&bd_type=3";
      } else if(efType == "zf"){
        url = "http://120.24.49.23:6080/dpr/go/forward?uri=dzg/activity_template&id=4gzzf&type=activities&child_type=4gzzf&index_url=dzg/edu_activities&"+getParams();
      } else if(efType == "zd"){
        url = "electr_flyer_zd.jpg"
      }
      console.log("url="+url);
      return url;
    }

    function initImage(){
      var efType = getParamValue("efType");
      console.log("efType="+efType);
      var imgFile="electr_flyer_index.jpg";
      var path = "/upload/image/campus/";
      if(efType == "ll"){
        imgFile = "electr_flyer_ll.jpg";
      } else if(efType == "kd"){
        imgFile = "electr_flyer_kd.jpg";
      } else if(efType == "zf"){
        imgFile = "electr_flyer_zf.jpg";
      } else if(efType == "zd"){
        imgFile = "electr_flyer_zd.jpg";
      }
      $("#image").attr("src", path+imgFile);
    }

    function getTitle(efType){
      var title = "";
       if(efType == "ll"){
        title = "新学期·流量耀更多！";
      } else if(efType == "kd"){
        title = "新学期·宽带耀更爽！";
      } else if(efType == "zf"){
        title = "新学期·资费耀更省！";
      } else if(efType == "zd"){
        title = "";
      }
      return title;
    }

    function getdescription(efType){
      var content = "";
       if(efType == "ll"){
        content = "校园流量套餐5折享，0元畅玩70G，人人都是流量王！";
      } else if(efType == "kd"){
        content = "20M校园宽带免费送，游戏追剧更尽兴！";
      } else if(efType == "zf"){
        content = "2G流量、2000分钟通话、20M校园宽带免费用，4G套餐全搞定！";
      } else if(efType == "zd"){
        content = "";
      }
      return content;
    }

    //返回页面分享的参数,当当前页面有canAppShare=1参数时需要添加此函数resShareParm(函数名不能改，客户端已经只调用这个函数)
    function resShareParm() {
      var efType = getParamValue("efType");
      var regText1 = "saleType=1";
      var regText2 = "saleType=3";
      var regS1 = new RegExp(regText1, "gi");
      var regS2 = new RegExp(regText2, "gi");
      var urlpath = window.location.href.replace(regS1, "saleType=2").replace(regS2, "saleType=4");//修改平台类型(原生分享出去统一改为分享平台)：1（直销通代客下单）改为 2（直销通分享页面购买） 3（微店原生购买）改为 4（微店分享购买）
      var imgpath = 'http://'+window.location.host+'/upload/file/default_head_img.png';
      var title = getTitle(efType);            
      var description = getdescription(efType);
      var data = "url=" + urlpath + "&&img=" + imgpath + "&&title=" + title + "&&description=" + description + "";
      return data;
    }

    function GetQueryString(name)
    {
         var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
         var r = window.location.search.substr(1).match(reg);
         if(r!=null)return  unescape(r[2]); return null;
    }
  </script>
</body>
</html>